package org.apollo.utils;

import java.net.MalformedURLException;
import java.net.URL;

import org.apollo.sys.Constants;

public class ResouceLoader {

	public static URL getFileURL(String url_name) {
		try {
			return new URL(Constants.PROTOCOL_FILE + url_name);
		} catch (MalformedURLException e) {
			e.printStackTrace();
			throw new RuntimeException("Malformed URL " + url_name, e);
		}
	}
	public static String getFilePath(String filePath) {
		return getFileURL(filePath).getPath();
	}

	/**
	 * @param url_name
	 * @return url
	 */
	public static URL getResouce(String url_name) {
		return ClassLoader.getSystemResource(url_name);
	}
}
